<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="rapid" uri="http://www.rapid-framework.org.cn/rapid" %>

<rapid:override name="title">
    - 所有公告
</rapid:override>
<rapid:override name="header-style">
    <style>
        /*覆盖 layui*/

        .layui-table {
            margin-top: 0;
        }

        .layui-btn {
            margin: 2px 0 !important;
        }
    </style>
</rapid:override>

<rapid:override name="content">

    <blockquote class="layui-elem-quote">
        <span class="layui-breadcrumb" lay-separator="/">
          <a href="/backIndex/homepage">首页</a>
          <a><cite>站内公告</cite></a>
          <a><cite>所有公告</cite></a>
        </span>
    </blockquote>


    <table class="layui-table">
        <colgroup>
            <col width="50">
            <col width="100">
            <col width="400">
            <col width="180">
            <col width="70">
            <col width="50">
        </colgroup>
        <thead>
        <tr>
            <th>id</th>
            <th>发布人</th>
            <th>标题</th>
            <th>发布时间</th>
            <th>状态</th>
            <td>操作</td>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${noticeList}" var="c">

            <tr>
                <td>
                        ${c.postId}
                </td>
                <td>
                        ${c.user.nickname}
                </td>
                <td>
                    <a href="/post/${a.postId}" target="_blank">${c.title}</a>
                </td>
                <td>
                    <fmt:formatDate value="${c.updateTime}"
                                    pattern="yyyy-MM-dd HH:mm:ss"/>
                </td>
                <td>
                    <c:choose>
                        <c:when test="${c.postStatus == 1}">
                            正常
                        </c:when>
                        <c:otherwise>
                            <span style="color:#FF5722;">已删除</span>
                        </c:otherwise>
                    </c:choose>
                </td>
                <td>
                    <c:choose>
                    <c:when test="${c.postStatus == 1}">
                    <a href="/post/deleteNotice/${c.postId}" class="layui-btn layui-btn-danger layui-btn-mini"
                       onclick="return confirmDelete()">删除</a>
                    </c:when>
                    <c:otherwise>
                    <a href="/post/recovery/${c.postId}" class="layui-btn layui-btn layui-btn-mini"
                       onclick="return confirmRecover()">恢复</a>
                    </c:otherwise>
                    </c:choose>
            </tr>

        </c:forEach>
        </tbody>
    </table>
    <%@ include file="../Public/paging.jsp" %>

</rapid:override>
<rapid:override name="footer-script">
    <script>

    </script>
</rapid:override>

<%@ include file="../Public/framework.jsp" %>
